// 用户相关操作
import ajax from '@/utils/request.js'
/**
 * login(){}用户登录
 * mobile : 手机号码
 * code : 密码
 */
export const login = (mobile, code) => {
  return ajax({
    method: 'POST',
    url: 'app/v1_0/authorizations',
    data: {
      mobile, code
    }
  })
}
/**
 * 获取用户个人信息
 */
export const getProfile = () => {
  return ajax({
    method: 'GET',
    url: '/app/v1_0/user/profile'
  })
}
/**
 * 关注用户
 */
export const followUser = (userId) => {
  return ajax({
    method: 'POST',
    url: '/app/v1_0/user/followings',
    data: {
      target: userId
    }
  })
}
/**
 * 取消关注
 */
export const unFollowUser = (userId) => {
  return ajax({
    method: 'DELETE',
    url: '/app/v1_0/user/followings/' + userId
  })
}
